package cis.android.signlocker.data;

import android.content.Context;
import android.os.Environment;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;

import cis.android.signlocker.signableview.SignDataRow;

/**
 * Created by MaiHoàng on 21/03/2014.
 */
public class IOSignData {
    public static final String ROOT_APP_DIR = "/SignData";

    public static void SaveToFile(Context context, ArrayList<SignDataRow> signData, String fileName) throws IOException {
        String data = XmlSignData.SignDataToXml(signData);

        File file = new File(context.getExternalFilesDir(null), fileName);
        OutputStream os = new FileOutputStream(file);
        os.write(data.getBytes());
        os.close();
    }
}
